<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Dessert House - 经理</title>
<link href="/ChristineCake/css/Management_List_NoButton.css"
	rel="stylesheet" type="text/css" />
<jsp:useBean id="shopMap" type="bean.ShopMonthStatisticsMapBean"
	scope="request" />
<jsp:directive.page import="bean.MonthStatisticsListBean" />
<jsp:directive.page import="model.Shop" />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
	google.load("visualization", "1", {
		packages : [ "corechart" ]
	});
	google.setOnLoadCallback(drawChart);
	function drawChart() {
<%Shop[] shop = shopMap.getShopList();
			for (int i = 0; i < shop.length; i++) {
				MonthStatisticsListBean monthList = shopMap
						.getStatistics(shop[i]);%>
	var data = google.visualization
				.arrayToDataTable([
						[ '月份', '销售额' ],
<%for (int j = 0; j < monthList.getList().size(); j++) {
					out.println("[ '" + monthList.getStatistics(j).getMonth()
							+ "', "
							+ monthList.getStatistics(j).getTotalConsumption()
							+ "], ");
				}%>
	]);

		var options = {
			title : '月销售额统计',
			backgroundColor : '#ffffaa'
		};

		var chart = new google.visualization.LineChart(document
				.getElementById('chart_div_'
						+
<%out.println(shop[i].getId());%>
	));
		chart.draw(data, options);
<%}%>
	}
</script>
</head>

<body>

	<div id="header">
		<div id="logo">
			<img src="/ChristineCake/image/logo.png" alt="logo" width="100%"
				height="100%" />
		</div>
		<div id="logout" align="right">
			<a href="/ChristineCake/jsp/LogIn.jsp">登出</a>
		</div>
	</div>

	<div id="menu">
		<ul>
			<li><a href="/ChristineCake/MemberCardStatisticsServlet">用户信息统计</a></li>
			<li><a href="/ChristineCake/TotalSaleStatisticsServlet">销售信息统计</a></li>
			<li><a href="/ChristineCake/MonthSaleStatisticsServlet">销售趋势预测</a>
		</ul>
	</div>

	<%
		Shop[] shopList = shopMap.getShopList();
		out.println("<div id=\"panel\" style=\"height:" + 500
				* shopList.length + "px\">");
		out.println("<div id=\"list\" style=\"height:"
				+ (500 * shopList.length - 10) + "px\">");
	%>

	<ul>
		<li id="listhead">销售信息统计</li>
		<li><a href="/ChristineCake/TotalSaleStatisticsServlet">总体销售情况</a></li>
		<li><a href="/ChristineCake/ShopSaleStatisticsServlet">店面销售情况</a></li>
		<li><a href="/ChristineCake/HotGoodsStatisticsServlet">热卖商品</a></li>
	</ul>

	<%
		out.println("</div>");
		out.println("<div id=\"content\" style=\"height:" + 460
				* shopList.length + "px\">");
		for (int i = 0; i < shopList.length; i++) {
			out.println("<div id=\"chart_div_" + shopList[i].getId()
					+ "\" class=\"chart_div\"></div>");
			out.println("<b>" + shopList[i].getName() + "</b>");
		}
		out.println("</div>");
		out.println("</div>");
	%>

	<hr />

	<div id="footer">
		<p>©南京大学软件学院 李冰洁</p>
	</div>

</body>

</html>